package com.xbongbong.pay.platform.wechatpay.config;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
 * 微信的配置容器
 * @author 魏荣杰
 * @date 2021/1/14 14:09
 * @since
 * @version
 */
public class WeChatPayMetaContainer {

    private final Map<String, WeChatPayMeta> weChatMetaMap = new HashMap<>();

    /**
     * Add wechat meta boolean.
     *
     * @param mchId
     * @param wechatPayMetaBean the wechat meta bean
     * @return the boolean
     */
    public WeChatPayMeta addWechatMeta(String mchId, WeChatPayMeta wechatPayMetaBean) {
        return this.weChatMetaMap.put(mchId, wechatPayMetaBean);
    }

    /**
     * Remove wechat meta wechat meta bean.
     *
     * @param mchId the mchId
     * @return the wechat meta bean
     */
    public WeChatPayMeta removeWechatMeta(String mchId) {
        return this.weChatMetaMap.remove(mchId);
    }

    /**
     * Gets wechat meta.
     *
     * @param mchId the mchId
     * @return the wechat meta
     */
    public WeChatPayMeta getWechatMeta(String mchId) {
        return Objects.requireNonNull(this.weChatMetaMap.get(mchId));
    }

}
